﻿
using AutoMapper.Configuration.Annotations;
using EasyCore.Domain.Entities;
using EasyCore.EndpointAudits;
using EasyCore.ObjectMapper;
using Microsoft.AspNetCore.Http.Metadata;
using NPOI.XSSF.UserModel;
using SqlSugar;

namespace EasyAdmin.Domain.Entities.Systems
{
    [MapFrom(typeof(EndpointAuditResult))]
    [SugarTable("sys_endpoint")]
    public class SysApiEndpoint : FullAuditedEntity
    {
        [SugarColumn(ColumnDescription = "唯一标识", IsNullable = false, IsIdentity = true, IsPrimaryKey = true)]
        public long Id { get; set; }

        [SugarColumn(ColumnDescription = "路由哈希", IsNullable = true, Length = 200)]
        public string RouthHash { get; set; }


        [SugarColumn(ColumnDescription = "请求方法", IsNullable = true, Length = 10)]
        public string HttpMethod { get; set; }

        [SugarColumn(ColumnDescription = "路由模板", IsNullable = true, Length = 150)]
        public string RouteTemplate { get; set; }

        [SugarColumn(ColumnDescription = "控制器名称", IsNullable = true, Length = 50)]
        public string ControllerName { get; set; }

        [SugarColumn(ColumnDescription = "方法名称", IsNullable = true, Length = 50)]
        public string ActionName { get; set; }

        [SugarColumn(ColumnDescription = "方法参数", ColumnDataType ="TEXT",IsNullable = true)]
        public string Parameters { get; set; } // JSON 格式存储参数信息

        [SugarColumn(ColumnDescription = "创建时间")]
        public DateTime CreatedTime { get; set; }

        [SugarColumn(ColumnDescription = "方法描述", IsNullable = true,ColumnDataType = "TEXT")]
        public string ActionSummary { get; set; }

        /// <summary>
        /// 构造函数
        /// </summary>
        public SysApiEndpoint()
        {
            CreatedTime = DateTime.Now;
        }
    }
}
